home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Singles Flirt Up Your Life! (German)
/
Singles Flirt Up Your Life.iso
/
data1.cab
/
Statemachine
/
tutorial2.lua
< prev
next >
Wrap
Text File
|
2004-01-29
|
2KB
|
100 lines
-- NOT_COMPLETE = 0;
-- JUST_COMPLETE = 1;
-- COMPLETE = 2;
function checkTutorial2Complete()
-- if mission is already complete: return 2
if (retrieveData("complete")) then
return 2;
end
-- check if mission is complete now
-- check elaine
local elaine = getParent().getCharacter(ELAINE);
-- return if there is no elaine
if (not elaine) then
return 0;
end
--local talk = elaine.getActivityCount("talkCasual");
--if talk < 1 then
-- not complete
-- return 0;
--end
--local hunger = elaine.getCondition(NEED_HUNGER);
--if hunger < 0.9 then
-- not complete
-- return 0;
--end
local friendship = elaine.getRelationshipCondition(MIKE, REL_FRIENDSHIP);
--elaine.incRelationshipCondition(MIKE, REL_FRIENDSHIP);
if friendship < 1 then
-- not complete
return 0;
end
-- check mike
local mike = getParent().getCharacter(MIKE);
--talk = mike.getActivityCount("talkCasual");
--if talk < 1 then
-- not complete
-- return 0;
--end
--hunger = mike.getCondition(NEED_HUNGER);
--if hunger < 0.9 then
-- not complete
-- return 0;
--end
friendship = mike.getRelationshipCondition(ELAINE, REL_FRIENDSHIP);
if friendship < 1 then
-- not complete
return 0;
end
-- now complete: return 1
storeData("complete", 1);
return 1;
end
beginStateMachine()
onEnter(function(msg)
popupMission();
end )
onMsg("getText", function(msg)
-- set mission text
if (checkTutorial2Complete() == 0) then
-- mission is not yet complete
setMissionText("tutorial2_name", "tutorial2_desc");
else
-- mission is complete
setMissionText("tutorial2_name", "tutorial2_finish");
end
end )
onMsg("checkComplete", function(msg)
if (checkTutorial2Complete() == 1) then
popupMission();
end
end )
onMsg("ok", function(msg)
print("2 ok pressed");
if (checkTutorial2Complete() == 2) then
exitStateMachine();
end
end )
endStateMachine()